package com.ease.integration.mina.core;

import org.apache.mina.core.service.IoHandlerAdapter;
import org.apache.mina.core.session.IdleStatus;
import org.apache.mina.core.session.IoSession;

public class MinaIoHandler extends IoHandlerAdapter {

	// private final Set<IoSession> sessions = Collections
	// .synchronizedSet(new HashSet<IoSession>());

	public void messageReceived(IoSession session, Object object) {
		String message = (String) object;
		session.write("Server Send: " + message);
		// sessions.add(session);
	}

	/** disconnect an idle client */
	public void sessionIdle(IoSession session, IdleStatus status) {
		session.close(true);
	}

	public void exceptionCaught(IoSession session, Throwable cause) {
		session.close(true);
	}

}